package com.xuecheng.test.rabbitmq;

import com.xuecheng.test.config.RabbitConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * Created by Aniymx on 2018/12/25 19:06.
 */
@SpringBootTest
@RunWith(SpringRunner.class)
public class ProducerSpringBoot {
    private static final String QUEUE_INFORM_EMAIL = "queue_inform_email";
    private static final String QUEUE_INFORM_SMS = "queue_inform_sms";
    private static final String EXCHANGE_ROUTING_INFORM = "exchange_routing_inform";
    @Autowired
    private RabbitTemplate rabbitTemplate;



@Test
    public void test(){
    for (int i = 0; i < 5; i++) {
        String msg = "helloworld"+i;
        rabbitTemplate.convertAndSend(RabbitConfig.EXCHANGE_TOPIC_INFORM,"inform.sms.email",msg);
        System.out.println(msg);
    }

}

}
